package com.jule.robot.service;

import com.jule.core.service.CronTaskManager;
import java.util.function.Consumer;

/**
 * 定时器启动类
 * @author ran.wang
 * @since 2018/11/7 14:21
 */
public class CronTaskService {

    public static final CronTaskService ME = new CronTaskService();

    public void addConsumer(Consumer<Object> consumer, String groupName, String reg){
        long t = System.currentTimeMillis();
        CronTaskManager.CountDownTask task = new CronTaskManager.CountDownTask(t, consumer);
        CronTaskManager.getInstance().addCountDownJob(task.getName(), groupName, task, reg);
    }

}
